In the field of electronic audio devices, when changing the gain at an output of, say, a speaker driver (or other audio device that changes gain in the analogue domain), it is necessary to change the gain at ‘zero crossing points’ within the audio signal, i.e. the (analogue sinusoidal) signal waveform changing from a positive value to a negative value and vice versa, in order to reduce distortion and avoid introduction of signal artefacts caused by gain changes during non-zero output currents.
FIG. 1 illustrates an example of a known technique 100 for controlling a gain of an audio signal. A required (requested) gain is illustrated at 110, which comprises an initial (hexadecimal) value of ‘0F’, illustrated generally at 112. An audio signal output by the analogue audio device is illustrated at 120, and initially comprises a gain that is substantially equivalent to the requested gain value 112. A zero crossing detector (ZCD) gain is also illustrated generally at 130, and which also comprises an initial value that is equal to that of the requested gain, namely ‘0F’, illustrated generally at 131.
At point 115, the value of the requested gain 110 is changed from ‘0F’ to a (hexadecimal) value of ‘0B’, illustrated generally at 117, thereby indicating that a change to the gain of the audio signal 120 is required. When a change of the requested gain 110 occurs, the ZCD gain 130 is incremented (or decremented, as required) every n zero crossing points detected in the audio signal 120, as illustrated at 132, 133, 134 and 135, until the ZCD gain 130 reaches the value of the requested gain 110. The gain of the audio signal 120 is incremented along with the ZCD gain 130. Specifically for the illustrated example, the ZCD gain 130 is incremented at every six zero crossing points that are detected in the audio signal 120, as illustrated generally at 140.
In this manner, gain changes to the audio signal 120 are made in single steps. Hence, if starting with a gain of, say, 0 dB, an increase to 12 dB may be implemented in six steps of 2 dB. For the illustrated example, gain changes are implemented every six zero crossing points, so in this example the gain increase from 0 dB to 12 dB would be implemented over thirty six zero crossing points. By ramping up the gain of the audio signal 120 in this manner, a sudden uncomfortable increase in ‘loudness’ experienced by a user is substantially avoided.
A problem with this known technique is that the ramp up/down time is primarily based on the number of zero crossing points per step (e.g. one step to every six crossing points). The time between zero crossing points is completely dependent upon the signal frequency, which may vary considerably, thereby resulting in significant variations in the ramp time depending upon the frequency of the signal, as illustrated below:
Signal FrequencyRamp Time (over 31 steps)200Hz2.5 ms * 31 steps = 77.5 ms1kHz0.5 ms * 31 steps = 15.5 ms20kHz25 μs * 31 steps = 0.775 ms
This inconsistency in the ramp up/down rate caused by the dependence on the signal frequency is undesirable, and in many circumstances unacceptable. For example, some DTMF (Dual-tone Multi-Frequency) specifications require that the audio signals are able to ramp up from mute to full volume within a limited period of time, which for lower frequency signals using this known technique is difficult to achieve. For example, if a 10 msec. ramp up time is required, and the time between zero crossings is 2 msec., the gain must be changed to the required value in five zero crossings. This forces a certain minimum gain step to be used in order to achieve the required gain increase within the available zero crossings. In addition, typically a common gain step has to be used by all frequencies, so very high frequency signals which have zero crossings occurring more frequently will have a very short ramp up time. Furthermore the discrepancy in the latency of the ramp up from mute to full volume is audibly noticeable.
An alternative technique for changing the gain of an output signal of analogue audio device, such as a speaker driver, is based on an adherence to an absolute ramp time for increasing/decreasing the gain, irrespective of the extent of the gain change or the frequency of the output signal. However, a technique that utilises an absolute ramp time for increasing/decreasing cannot be synchronised to zero crossings.
Thus, a need exists for an improved technique for controlling a gain applied to an audio signal, and method of operation therefor.